﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure.Web.Views.Master;
using Microsoft.Practices.Unity;
using Infrastructure.Web.Extensions;
using Infrastructure.Aspect.Extensions;
using System.ComponentModel;
namespace Skynet.WebAdministracion.Views.ExamsDynMgm
{
    [DataObject]
    public class ExamsDynMgmPresenter : MasterPresenter<IExamsDynMgmView>
    {

        [Dependency]
        public BusinessLogic.BusinessComponents.IBCExams BCExams { get; set; }


        [Dependency]
        public BusinessLogic.BusinessComponents.IBCExamQueries BCExamQueries { get; set; }

        public override void OnViewInitialized()
        {
            
        }
        [DataObjectMethod(DataObjectMethodType.Insert, false)]
        public void AddExamen(Model.WEExam item)
        {
            
        }
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public IEnumerable<Model.WEExam> GetExams()
        {
            var exams  = this.BCExamQueries.SearchExams();
            var rexam = new List<Model.WEExam>();
            foreach (var item in exams)
            {
                var re = new Model.WEExam();
                re.Titulo = item.Title;
                re.Resumen = item.Summary;
                rexam.Add(re);                 
            }
            return rexam;  
        }
    }
}
